home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13678 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: mayne.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: making #define's to be seen across files
  5. Date: 9 Apr 1996 11:51:40 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4kebjsINN60v@mayne.ugrad.cs.ubc.ca>
  8. References: <1996Apr9.164443.28709@relay.nswc.navy.mil>
  9. NNTP-Posting-Host: mayne.ugrad.cs.ubc.ca
  10.  
  11. In article <1996Apr9.164443.28709@relay.nswc.navy.mil>,
  12. David R. Heffelfinger <dheffel@vitds2.nswc.navy.mil> wrote:
  13.  >Hi there,
  14.  >    There is (hopefully) a simple answer to my question:
  15.  >
  16.  >I have some C code divided into different source files.
  17.  >When I try to compile using 
  18.  >  "cc file1.c file2.c file3.c"
  19.  >the constants #define'd in file1.c are not visible in file2.c, is there a way to make them visible to the other source files?  In other words, is there som equivalent to "extern" for constants?
  20.  >
  21.  >Any help will be deeply appreciated.
  22.  
  23. Ha! There is one question we haven't seen around here!
  24.  
  25. You have to move these #defines to a separate file, usually named with a .h
  26. suffix. Then you #include this file in all the others.
  27.  
  28. -- 
  29.  
  30.